package com.nit.trash.dto;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;

public class GarbageDTO {
    private Long key;
    private Long garbageId;
    private String garbageName;
    private String imageUrl;
    private String originalName;
    private Integer sortId;
    private String garbageFlag;
    private String sortName;
    private String sortInfo;
    private Integer total;
    private Integer right;
    private Integer wrong;
    private Integer noAnswer;
    private Double accuracy;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date gmtCreate;

    public GarbageDTO() {
    }

    public GarbageDTO(Long key, Long garbageId, String garbageName, String imageUrl, String originalName, Integer sortId, String garbageFlag, String sortName, String sortInfo, Integer total, Integer right, Integer wrong, Integer noAnswer, Double accuracy, Date gmtCreate) {
        this.key = key;
        this.garbageId = garbageId;
        this.garbageName = garbageName;
        this.imageUrl = imageUrl;
        this.originalName = originalName;
        this.sortId = sortId;
        this.garbageFlag = garbageFlag;
        this.sortName = sortName;
        this.sortInfo = sortInfo;
        this.total = total;
        this.right = right;
        this.wrong = wrong;
        this.noAnswer = noAnswer;
        this.accuracy = accuracy;
        this.gmtCreate = gmtCreate;
    }

    public Long getKey() {
        return key;
    }

    public void setKey(Long key) {
        this.key = key;
    }

    public Long getGarbageId() {
        return garbageId;
    }

    public void setGarbageId(Long garbageId) {
        this.garbageId = garbageId;
    }

    public String getGarbageName() {
        return garbageName;
    }

    public void setGarbageName(String garbageName) {
        this.garbageName = garbageName;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public String getOriginalName() {
        return originalName;
    }

    public void setOriginalName(String originalName) {
        this.originalName = originalName;
    }

    public Integer getSortId() {
        return sortId;
    }

    public void setSortId(Integer sortId) {
        this.sortId = sortId;
    }

    public String getGarbageFlag() {
        return garbageFlag;
    }

    public void setGarbageFlag(String garbageFlag) {
        this.garbageFlag = garbageFlag;
    }

    public String getSortName() {
        return sortName;
    }

    public void setSortName(String sortName) {
        this.sortName = sortName;
    }

    public String getSortInfo() {
        return sortInfo;
    }

    public void setSortInfo(String sortInfo) {
        this.sortInfo = sortInfo;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getRight() {
        return right;
    }

    public void setRight(Integer right) {
        this.right = right;
    }

    public Integer getWrong() {
        return wrong;
    }

    public void setWrong(Integer wrong) {
        this.wrong = wrong;
    }

    public Integer getNoAnswer() {
        return noAnswer;
    }

    public void setNoAnswer(Integer noAnswer) {
        this.noAnswer = noAnswer;
    }

    public Double getAccuracy() {
        return accuracy;
    }

    public void setAccuracy(Double accuracy) {
        this.accuracy = accuracy;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }
    public void initAccuracy() {
        if (total == 0) {
            accuracy = (double) 0;
        } else {
            accuracy = (double) right / total;
        }
    }

    public void initNoAnswer() {
        noAnswer = total - right - wrong;
    }
}
